<!--!
This file is a part of MediaDrop (https://www.mediadrop.video),
Copyright 2009-2018 MediaDrop contributors
For the exact contribution history, see the git revision log.
The source code contained in this file is licensed under the GPLv3 or
(at your option) any later version.
See LICENSE.txt in the main project directory, for more information.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      py:strip="">
	<table py:def="comment_table(collection, edit_form, include_thead=True, id='comment-table', classes=None)"
	    cellpadding="0" cellspacing="0" id="${id}" class="${classes}"
	    py:with="item_count = len(collection);
	             include_thead = include_thead and item_count > 0;
	             paginator = c.paginators.comments;">
		<thead py:if="include_thead">
			<tr>
				<th id="h-bulk" style="width:20px"><input type="checkbox" class="bulk-toggle" /></th>
				<th style="width:55px">Status</th>
				<th style="width:100px">Author</th>
				<th style="width:auto">Comment</th>
				<th style="width:200px">In Response to</th>
			</tr>
		</thead>
		<tbody>
			<tr py:if="item_count == 0">
				<td>None Found</td>
			</tr>
			<tr py:for="comment in collection" id='comment-${comment.id}' class="${comment.reviewed and 'tr-gray' or 'tr-white'}">
				<td headers="h-bulk"><input type="checkbox" class="bulk-checkbox" /></td>
				<td>
					<form class="comment-status-form" action="${h.url_for(action='save_status', id=comment.id)}" method="post">
						<div py:with="pub_class=''">
							<span py:if="comment.reviewed" class="btn table-row published btn-inline-approve middle f-lft unclickable" title="This comment has already been approved for publishing"><span></span></span>
							<button py:if="not comment.reviewed" class="btn table-row publish btn-inline-approve middle f-lft" title="Approve this comment for publishing" name="status" value="approve"><span>Approve</span></button>
							<button class="btn table-row delete btn-inline-delete f-lft" title="Delete this comment" name="status" value="trash"><span>Trash</span></button>
						</div>
					</form>
				</td>
				<td class="author">
					<div><strong class="author-name" py:content="comment.author.name">Author</strong></div>
					<div><a href="mailto:${comment.author.email}" py:content="comment.author.email">Email</a></div>
					<div class="comment-ip" py:content="comment.author.ip">Author IP</div>
				</td>
				<td>
					<div class="comment-submitted">Submitted on ${h.format_date(comment.created_on)}</div>
					${edit_form(comment, action=h.url_for(action='save_edit', id=comment.id))}
				</td>
				<td>
					<a py:content="comment.parent.title" target="_blank"
					   href="${h.url_for(controller='/%s' % comment.type, action='view', slug=comment.parent.slug)}"
					   title="${comment.type.capitalize()}">Parent Item</a><br />
					<a target="_blank"
					   href="${h.url_for(controller='/admin/%s' % comment.type, action='edit', id=comment.parent.id)}"
					   title="Go to the admin page for this item"><small>Edit</small></a>
				</td>
			</tr>
		</tbody>
		<xi:include href="../helpers.html" />
		${paginated_tfoot(paginator, '5')}
	</table>
</html>
